package com.topvision.myviewtest.mvp.provider;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;

/**
 * Author: lucy
 * Comment: //TODO
 * Date: 2017-12-11 11:34
 */

public class RetrofitProvider {

    private static final String BASE_URL = "http://www.weather.com.cn/";

    public static Retrofit get() {
        OkHttpClient.Builder okhttpClient = new OkHttpClient.Builder();
        okhttpClient
                .connectTimeout(10, TimeUnit.SECONDS)
                .readTimeout(10, TimeUnit.SECONDS);

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(ScalarsConverterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .client(okhttpClient.build())
                .build();
        return retrofit;
    }
}
